def quicksort(xs):
    if len(xs) <= 1:
        return xs
    else:
        return quicksort([x for x in xs[1:] if x <= xs[0]]) + [xs[0]] + quicksort([x for x in xs[1:] if x > xs[0]])

print(quicksort([3,6,8,10,1,2,1]))
# Prints "[1, 1, 2, 3, 6, 8, 10]"

qsort = lambda xs: xs and qsort([x for x in xs[1:] if x <= xs[0]]) + [xs[0]] + qsort([x for x in xs[1:] if x > xs[0]])
print(qsort([5, 4, 9, 1]) )
print(qsort([3,6,8,10,1,2,1]))

qs = lambda xs : ( (len(xs) <= 1 and [xs]) or [ qs( [x for x in xs[1:] if x < xs[0]] ) + [xs[0]] + qs( [x for x in xs[1:] if x >= xs[0]] ) ] )[0]
print(qs([3,6,8,10,1,2,1]))